Acquiring the Access Token
Prior to accessing the device's REST API, you need to acquire the access token using the REST Client application credentials.
|
➢
|
To acquire access token: |
|
1.
|
Send a POST request to Microsoft identity platform’s token endpoint: |
// Line breaks are for legibility only
POST https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token
FORM DATA: {
grant_type=client_credentials
client_id=<rest_client_id>
client_secret=<rest_client_secret>
scope=api://<sbc_manager_client_id>/.default
}
Replace the following:
|
●
|
<tenant_id> with your tenant ID. |
|
●
|
<rest_client_id> and <rest_client_secret> with the client ID and secret of the REST Client application. |
|
●
|
<sbc_manager_client_id> with the client ID of the device's application (e.g., "SBC manager"). |
Example:
curl --location --request POST 'https://login.microsoftonline.com/1911c65c-893b-42f9-83fa-66c1b86fdf85/oauth2/v2.0/token'
--form grant_type="client_credentials"
--form client_id="a26aff59-0bba-42bc-b0a0-87c1e292ef89"
--form client_secret="HMMx3_.pb6XQ26gwiHY45BttS7~Axt_yBH"
--form scope="api://faea2ec7-659a-4c46-8d2a-83436882fdd7/.default"
|
2.
|
A successful response contains the access token: |
200 OK
Content-Type: application/json
{
"token_type":"Bearer",|
"expires_in":3599,
"ext_expires_in":3599,
"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs..."